package com.wei.web.middleware.httpfilter.auth.security;

import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;

public class WebSecurityCustomizerFactoryBean extends AbstractFactoryBean<WebSecurityCustomizer> {

    private String[] ignoreUrlList;

    public WebSecurityCustomizerFactoryBean(String[] ignoreUrlList) {
        this.ignoreUrlList = ignoreUrlList;
    }

    @Override
    public Class<?> getObjectType() {
        return WebSecurityCustomizer.class;
    }

    @Override
    protected WebSecurityCustomizer createInstance() throws Exception {
        return (web) -> {
            web.ignoring().requestMatchers(ignoreUrlList);
        };
    }
}
